package com.happyfamily.springboot.crowdsourcingplatform.dao.weng;

import com.happyfamily.springboot.crowdsourcingplatform.model.IndustryDynamics;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface IndustryDynamicsDao
{
	int save(List<IndustryDynamics> list);

	@Select("select count(*) from industry_dynamics")
	Long countAllIndustryInfos();

	@Select("select * from industry_dynamics order by ntime desc limit #{startPosition},#{limit}")
	List<IndustryDynamics> getAllIndustryByPage(Integer startPosition, Integer limit);

	@Delete("delete from industry_dynamics where nid = #{nid}")
	int deleteIndustry(Integer nid);

	@Update("update industry_dynamics set tips1 = '管理员',tips2 = curdate() where nid = #{nid}")
	int openIndustry(Integer nid);

	@Update("update industry_dynamics set tips1 = '',tips2 = '' where nid = #{nid}")
	int closeIndustry(Integer nid);

	Long getIndustryByFuzzy(String ntitle, String getDate, String ncontent);

	List<IndustryDynamics> getIndustryByFuzzyPage(String ntitle, String getDate, String ncontent, Integer startPosition, Integer limit);

	@Update("update industry_dynamics set ntitle = #{ntitle} where nid = #{nid}")
	int industryEdit(Integer nid, String ntitle);

	@Select("select * from industry_dynamics where ncontent='数码通讯' order by tips2 desc limit 0,10")
	List<IndustryDynamics> frontGetIndustryByShu();


	@Select("select * from industry_dynamics where ncontent='生活服务' order by tips2 desc limit 0,10")
	List<IndustryDynamics> frontGetIndustryBySheng();


	@Select("select * from industry_dynamics where ncontent='智能硬件' order by tips2 desc limit 0,10")
	List<IndustryDynamics> frontGetIndustryByZhi();


	@Select("select * from industry_dynamics where ncontent='软件科学' order by tips2 desc limit 0,10")
	List<IndustryDynamics> frontGetIndustryByRu();
}
